<?php $current_app = sfConfig::get('sf_app'); ?>
<?php if ($sf_user->getPage()->WallConfig->is_active && $current_app === 'fsmartshop') include_partial('commons/publishJobScript') ?>
<script>
<!--
fss.needPagePublishPermission = true;
var state_window = 0;
var cur_state = '';
var dialog_context = null;
var dialog_share;
var twitter_config = false;
var filters_empty  = <?php echo (isset($filters_empty) ? (int)$filters_empty : '1') ?>;

function check_email(value) {
    return /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
}

var pager = {
    page: 1,
    current_sort_by: '<?php echo $sort_by ?>',
    current_sort_order: 1,
    current_view: '',
    max_per_page: <?php echo $max_per_page ?>,

    listReload: function (page, new_max_per_page, sort_loader)
    {
        this.page = page;
        if (new_max_per_page) {
            this.max_per_page = new_max_per_page;
        }

        $('#'+sort_loader).html('<span class="loaderMini valign-bottom"></span>');

      <?php if($current_app !== 'fsmartshop' || $usecase === 'school_backoffice'): ?>
        if (this.current_view !== 'inactive' && !filters_empty) {
            $('#search_filters').show();
            var params = $('#filterForm').serializeObject();
            for (filter_name in search_has_text)
                if (!search_has_text[filter_name])
                    delete params[filter_name];
        } else {
            var params = {};
            $('#search_filters').hide();
        }
      <?php endif ?>

        params.sort_by      = this.current_sort_by;
        params.sort_order   = this.current_sort_order;
        params.page         = this.page;
        params.view         = this.current_view;
        params.max_per_page = this.max_per_page;

        $('#indexAjax').html('<div align="center"><div class="loader_admin"></div>').show();
      <?php if ($current_app !== 'fsmartshop'): ?>
        $('#indexAjax').load('<?php echo url_for('@backoffice_list', true) ?>', params);

      <?php else: ?>
        <?php if($usecase === 'recruiter_backoffice'): ?>
        $('#indexAjax').load('<?php echo url_for('@recruiter_backoffice_job_list', true) ?>', params);
        <?php elseif($usecase === 'school_backoffice'): ?>
        $('#indexAjax').load('<?php echo url_for('@school_backoffice_job_list', true) ?>', params);
        <?php elseif($usecase === 'school_backoffice_moderation'): ?>
        $('#indexAjax').load('<?php echo url_for('@school_backoffice_job_pending_moderation_list', true) ?>', params);
        <?php endif ?>
      <?php endif ?>
    },


    reload: function(link, no_save_search)
    {
        this.listReload(this.page, this.max_per_page);
    },

    sort: function(sort_by, sort_order, sort_loader)
    {
        if (sort_by != this.current_sort_by) {
            this.current_sort_by = sort_by;
            this.current_sort_order = sort_order;
        } else if (this.current_sort_order) {
            this.current_sort_order = 0
        } else {
            this.current_sort_order = 1;
        }
        this.listReload(1, null, sort_loader);
    },

    filter: function filter(view)
    {
        this.current_view = view;
        $('#indexAjax').html('<div align="center"><div class="loader_admin"></div></div>');
        this.listReload(1);
    }

}

function showChangeJobState(job_id)
{
    if (!state_window) {
        state_window++;
        cur_state = $('#state'+job_id).val();
        $('#wrapper'+job_id).addClass('edit_mode');
    }
}

function hideChangeJobState(job_id)
{
    $('#wrapper'+job_id).removeClass('edit_mode');
    $('#state'+job_id).val(cur_state);
    --state_window;

}

function changeJobState(job_id, campaign, el)
{
    $('#loaderMini'+job_id).show();
    var new_state = $('#state'+job_id).val();
    var dialog_title = null;
    var dialog_message = null;
    var expire = false;

    if (cur_state == 'inactive' && new_state != 'inactive') {
        dialog_title = <?php echo json_encode(__('Prolong your job')) ?>;
        dialog_message = <?php echo json_encode('<p class="message-yellow ma0">'.__('Would you like to repost this job for 2 months?').'</p>') ?>;
        expire = true;
    } else if ((cur_state == 'active' || cur_state == 'paused') && new_state == 'inactive') {
        dialog_title = <?php echo json_encode(__('Delete your job')) ?>;
        if (campaign)
            dialog_message = <?php echo json_encode('<p class="message-yellow ma0">'.__('Would you really like to delete this job and stop its campaign at the same time?').'</p>') ?>;
        else
            dialog_message = <?php echo json_encode('<p class="message-yellow ma0">'.__('Would you really like to delete this job?').'</p>') ?>;
    } else {
        updateJobState(job_id, cur_state, new_state, expire);
    }

    if (dialog_title) {
        fss.View.anchor(el);
        new fss.Dialog({
            title: dialog_title,
            message: dialog_message,
            confirm: <?php echo json_encode(__('Submit')) ?>,
            cancel: <?php echo json_encode(__('Cancel')) ?>,
            onconfirm: function() {
                updateJobState(job_id, cur_state, new_state, expire);
            },
            oncancel: function() {
                $('#loaderMini'+job_id).hide();
                hideChangeJobState(job_id);
                fss.View.reset();
            }
        });
    }
}

function updateJobState(job_id, cur_state, new_state, expire)
{
    hideChangeJobState(job_id);

    // show the loader only if the state change
    if (cur_state != new_state) {
        $('#wrapper'+job_id).hide();
        $('#loaderMini'+job_id).css('display: inline-block');
    }

    $.post('<?php echo url_for('@backoffice_job_state') ?>', {
        'job_id': job_id,
        'state':  new_state,
        'expire': expire
    }, function (data) {
        $('#loaderMini'+job_id).hide();
        if (data.success && !data.is_over_quota)
            updateJobStateSuccess(data, job_id, cur_state, new_state);
        else
            updateJobStateFailure(data, job_id, cur_state, new_state);
        fss.View.reset();
    }, 'json');
}

function updateJobStateSuccess(data, job_id, cur_state, new_state)
{
    if (cur_state === 'inactive' && cur_state != new_state)
        pager.filter('active');

    $('#share_action_display_'+job_id).hide();
    $('#share_action_disabled_display_'+job_id).hide();
    $('#campaign_action_create_disabled_'+job_id).hide();
    $('#campaign_action_create_'+job_id).hide();
    $('#campaign_action_create_disabled_'+job_id).hide();
    $('#campaign_action_edit_'+job_id).hide();
    $('#campaign_action_edit_disabled_'+job_id).hide();

    if (new_state == 'active') {
        $('#share_action_display_'+job_id).show();
        new_label = <?php echo json_encode(__('Active', null, 'core')) ?>;
        if (data.has_campaign)
            $('#campaign_action_edit_'+job_id).show();
        else
            $('#campaign_action_create_'+job_id).show();
    } else if (new_state == 'paused') {
        $('#share_action_disabled_display_'+job_id).show();
        new_label = <?php echo json_encode(__('Paused', null, 'core')) ?>;
        if (data.has_campaign)
            $('#campaign_action_edit_disabled_'+job_id).show();
        else
            $('#campaign_action_create_disabled_'+job_id).show();
    } else if (new_state == 'inactive') {
        $('#share_action_disabled_display_'+job_id).show();
        new_label = <?php echo json_encode(__('Deleted', null, 'core')) ?>;
        if (data.has_campaign)
            $('#campaign_action_edit_disabled_'+job_id).show();
        pager.listReload(<?php echo $pager->getPage() ?>);
    } else {
        new_label = '';
    }

    if (cur_state != new_state) {
        $('#loadermini'+job_id).hide();
        $('#wrapper'+job_id).show();
        $('#icon'+job_id).removeClass('icon_'+cur_state).addClass('icon_'+new_state);
    }
    $('#btn_status'+job_id).text(new_label);
    $('#state'+job_id).val(new_state);
    $('#slot_number').text(data.slots);
}

function updateJobStateFailure(data, job_id, cur_state, new_state)
{
    var message = "";
    var title = "";
    new_label = <?php echo json_encode(__('Paused', null, 'core')) ?>;
    if (cur_state != new_state) {
       $('#loaderMini'+job_id).hide();
       $('#wrapper'+job_id).show();
       $('#icon'+job_id).removeClass('icon_'+new_state).addClass('icon_'+cur_state);
    }
    if (data.is_over_quota) {
        title = <?php echo json_encode(__('No slot available')) ?>;
        message = <?php echo json_encode(__('All your job slots are in use. You can pause an active job to free a slot or subscribe to a better plan.')) ?>;
    } else {
        title = <?php echo json_encode(__('Error')) ?>;
        message = <?php echo json_encode(__('Unknown error, please refresh your page and try again')) ?>;
    }
    new fss.Dialog({
        title : title,
        message : message,
        confirm: <?php echo json_encode(__('Close')) ?>,
        width : 300,
        unique : true
    });
}

<?php if ($current_app === 'fsmartshop'): ?>
function displayChangeModerationStatus(job) {
    if(!state_window) {
        state_window++;
        $('#moderation_wrapper'+job).addClass('edit_mode edit_mode_with_buttons');
    }
}

function hideChangeModerationStatus(job) {
    $('#moderation_wrapper'+job).removeClass('edit_mode edit_mode_with_buttons');
    --state_window;
}

function changeModerationStatus(job) {
    var expire = false;
    var new_moderation_state = $('#moderation_status'+job).val();
    updateJobModerationState(job, new_moderation_state);
}

function updateJobModerationState(job, new_moderation_state) {
    hideChangeModerationStatus(job);
    $('#moderation_wrapper'+job).hide();
    $('#loaderMini_moderation'+job).show();

    if (new_moderation_state == 'accepted') {
        new_label = <?php echo json_encode(__('Accepted')) ?>;
    }
    s
    $.post('<?php echo url_for('@school_backoffice_ajax_call_change_job_moderation_state', true) ?>', {
        'job_id': job,
        'moderation_state': new_moderation_state
    }, function (data) {
        if (json.success) {
            $('#loaderMini_moderation'+job).hide();
            $('#moderation_wrapper'+job).show();

            if (new_moderation_state == 'accepted') {
                new_label = <?php echo json_encode(__('Accepted')) ?>;
                <?php if ($sf_user->getPage()->WallConfig->is_active): ?>
                    publishJobToStream(job, true);
                <?php endif ?>
            } else if (new_moderation_state == 'rejected') {
                new_label = <?php echo json_encode(__('Rejected')) ?>;
            } else
                new_label = '';

            $('#moderation_icon'+job).addClass('FB_icons icon_'+new_moderation_state);
            $('#btn_moderation_status'+job).text(new_label);
            $('#moderation_status'+job).val(new_moderation_state);
        } else {
        }
    }, 'json');
}

<?php else: // ie not Jobs4me ?>

function changeTabDialog()
{
    new fss.Dialog({
        title: <?php echo json_encode(__('Change Tab Name')) ?>,
        content: $('#change_tab_form'),
        confirm: <?php echo json_encode(__('Validate')) ?>,
        cancel: <?php echo json_encode(__('Cancel')) ?>,
        unique: true,
        onconfirm: function() {
            var canvas_name = $('#change_tab_form #canvas_name').val();
            top.location.href = '<?php echo ($sf_request->isSecure() ? 'https' : 'http') ?>://apps.facebook.com'+canvas_name+'<?php echo url_for('@change_tab_step0', false) ?>';
        }
    });
}

function changeTabDisabledDialog(context)
{
    new fss.Dialog({
        context: context,
        littleClose: true,
        width: 450,
        content: $('#change_tab_disabled'),
        confirm: <?php echo json_encode(__('OK')) ?>
    });
}

function addEmailInfo()
{
   new fss.Dialog({
        title: <?php echo json_encode(__('Update your contact info')) ?>,
        content : $('#update_email_tab'),
        confirm: <?php echo json_encode(__('Update')) ?>,
        cancel: <?php echo json_encode(__('Close')) ?>,
        unique: true,
        onconfirm: function() {
            $.post('<?php echo url_for('@backoffice_update_email', false)?>',
                    {email:$('#step1_email').val()},
                    function (success){
                      if (!check_email($('#step1_email').val())) {
                        $('#error_email').show();
                        addEmailInfo();
                      }
                    });
        }
    });
}
<?php endif ?>

function showDialogShare(context, job_id)
{
    dialog_context = context;
    dialog_share = new fss.Dialog({
        content: $('#share_'+job_id),
        confirm: <?php echo json_encode(__('Close')) ?>,
        width: 250,
        context: context,
        littleClose: 'yes'
    });
}

function showDialogShareDisabled(context)
{
    new fss.Dialog({
        content: $('#share_disabled'),
        confirm: <?php echo json_encode(__('Close')) ?>,
        width: 350,
        context: context,
        littleClose: 'yes'
    });
}

function wallPreview(job_id)
{
    $('#share_loader' + job_id).show();
    $.get(
        '<?php echo url_for('@backoffice_post_form_content') ?>',
        { job_id: job_id },
        function(content)
        {
            dialog_share.remove();
            fss.View.anchor(dialog_context);
            $('#share_loader' + job_id).hide();
            new fss.Dialog({
                title: <?php echo json_encode(__('Customize your posting')) ?>,
                content: $(content),
                cancel: <?php echo json_encode(__('Close')) ?>,
                confirm: <?php echo json_encode(__('Publish')) ?>,
                onconfirm: function()
                {
                    publishJob(job_id);
                    $('#wall_sharing_title_' + job_id).show();
                    $('#wall_custom_title_' + job_id).hide();
                    $('#custom_wall_preview_' + job_id).hide();
                    $('#wall_preview_' + job_id).show();
                },
                oncancel: function()
                {
                    $('#wall_sharing_title_' + job_id).show();
                    $('#wall_custom_title_' + job_id).hide();
                    $('#custom_wall_preview_' + job_id).hide();
                    $('#wall_preview_' + job_id).show();
                }
            });
            fss.View.anchor(null);
    });
}

function twitterPreview(job_id, bind)
{
    $('#share_loader'+job_id).show();

    $.get(
        '<?php echo url_for('@backoffice_tweet_form_content') ?>&bind='+bind,
        { job_id: job_id },
        function(content)
        {
            getTwitterConfig();
            dialog_share.remove();
            $('#share_loader'+job_id).hide();
            fss.View.anchor(dialog_context);
            new fss.Dialog({
                title: <?php echo json_encode(__('Customize your posting')) ?>,
                content: $(content),
                cancel: <?php echo json_encode(__('Close')) ?>,
                confirm: <?php echo json_encode(__('Publish')) ?>,
                onconfirm: function() {
                    if ($('#text_custom_twitter_preview_'+job_id).val().length > 140){
                        $('#twitter_max_length_'+job_id).show();
                        twitterPreview(job_id, "1");
                    } else {
                        postJobOnTwitter(job_id);
                        $('#twitter_max_length_'+job_id).hide();
                        $('#custom_twitter_preview_'+job_id).hide();
                        $('#twitter_preview_'+job_id).show();
                    }
                },
                oncancel: function() {
                    $('#twitter_max_length_'+job_id).hide();
                    $('#custom_twitter_preview_'+job_id).hide();
                    $('#twitter_preview_'+job_id).show();
                }
            });
            fss.View.anchor(null);
        });
}

function editWallSharingTitle(job_id)
{
    $('#wall_sharing_title_'+job_id).hide();
    $('#wall_custom_title_'+job_id).show();
}

function editWallPreviewJob(job_id)
{
    $('#custom_wall_preview_'+job_id).show();
    $('#wall_preview_'+job_id).hide();
}

function editTwitterPreviewJob(job_id)
{
    $('#custom_twitter_preview_'+job_id).show();
    $('#twitter_preview_'+job_id).hide();
}

function postJobOnTwitter(job_id)
{
    if (!twitter_config) {
        var url = '<?php echo url_for('@twitter_redirect?in_install='.$sf_request->getParameter('in_install', 0)) ?>&job_id='+job_id+'&post='+encodeURIComponent($('#text_custom_twitter_preview_'+job_id).val());
        window.open(url, '', 'height=500, width=750');
    } else {
        $.post('<?php echo url_for('@backoffice_tweet') ?>&job_id='+job_id, {
        'job_preview':  $('#text_custom_twitter_preview_'+job_id).val()
        }, function (data) {
            if (data.success)
                new fss.Dialog({
                    title: <?php echo json_encode(__('Twitter posting successful')) ?>,
                    content: $('#twitter_wall_success'),
                    cancel: <?php echo json_encode(__('Close')) ?>
                });
            else
                new fss.Dialog({
                    title: <?php echo json_encode(__('Twitter posting error')) ?>,
                    content: $('#twitter_wall_error'),
                    cancel: <?php echo json_encode(__('Close')) ?>
                });

            dialog_share.remove();
        }, 'json');
    }
}

function getTwitterConfig()
{
    <?php if($sf_user->getPage()->TwitterConfig->access_token && $sf_user->getPage()->TwitterConfig->access_token_secret):?>
        twitter_config = true;
    <?php else:?>
    $.post('<?php echo url_for('@frontoffice_page_twitter_config') ?>', {<?php /* Force POST */ ?>}, function (data) {
        if (data.success){
            twitter_config = true;
        }
    }, 'json');
    <?php endif ?>
}

function publishJob(job_id)
{
    if (fss.needPagePublishPermission)
        fss.requestPagePublishPermission(function(){doPublishJob(job_id);},true);
    else
        doPublishJob(job_id);
}

function doPublishJob(job_id)
{
    $.post('<?php echo url_for('@backoffice_post') ?>&job_id='+job_id, {
        'job_title': $('#wall_custom_title_'+job_id).val(),
        'job_preview':  $('#custom_wall_preview_'+job_id).val()
               }, function (data) {
            if (data && data.success)
                new fss.Dialog({
                    title: <?php echo json_encode(__('Wall posting successful')) ?>,
                    content: $('#post_wall_success'),
                    cancel: <?php echo json_encode(__('Close')) ?>
                });
            else
                new fss.Dialog({
                    title: <?php echo json_encode(__('Wall posting error')) ?>,
                    content: $('#post_wall_error'),
                    cancel: <?php echo json_encode(__('Close')) ?>
                });

        }, 'json');

}

function fssTrack(link_name)
{
    return false;
}

fss.loginReady(function(){
    <?php if($current_app !== 'fsmartshop' || $usecase !== 'recruiter_backoffice'): ?>
    fss.checkPermission(<?php echo $sf_user->getUid() ?>, 'publish_stream,manage_pages', function (enabled) {
        if (enabled)
            fss.needPagePublishPermission = false;
    });
    <?php endif ?>

    <?php if (isset($approval_message) && $approval_message): ?>
    <?php switch ($approval_message) {
             case 'success':
                $message = __('Job succesfully approved!');
                break;
             case 'error':
                $message = __("This job can't be approved.");
                break;
             case 'already_done':
                $message = __('This job has already been approved!');
          } ?>
      var dialog = new fss.Dialog({
          title: <?php echo json_encode(__('Approval')) ?>,
          message: <?php echo json_encode($message) ?>,
          confirm: <?php echo json_encode(__('Close')) ?>
          });
    <?php endif ?>

<?php if($current_app !== 'fsmartshop'): ?>
    <?php if ($sf_request->getParameter('over_quota')): ?>
    new fss.Dialog({
            title: <?php echo json_encode(__('Job paused')) ?>,
            content: $('#job_paused_confirm_message'),
            confirm: <?php echo json_encode(__('Close')) ?>
            });
    <?php endif ?>
    <?php if (empty($billing_email)): ?>
    addEmailInfo();
    <?php elseif (!empty($show_campaign_dialog_for_job)): ?>
    createCampaign(<?php echo $show_campaign_dialog_for_job->job_id ?>);
    <?php endif ?>

    <?php if ($sf_user->getPage()->State->showDialog()): ?>
      var dialog = new fss.Dialog({title:$('#state_dialog_title').html(), content:$('#state_dialog_text')});
    <?php endif ?>

    <?php if ($sf_request->getParameter('payment_failed')): ?>
      var dialog = new fss.Dialog({title:<?php echo json_encode(__('Confirmation')) ?>, content:$('#payment_failed')});
    <?php endif ?>

    <?php if ($sf_request->getParameter('subscription_failed')): ?>
      var dialog = new fss.Dialog({title:<?php echo json_encode(__('Confirmation')) ?>, content:$('#subscription_failed')});
    <?php endif ?>

    <?php if ($sf_request->getParameter('payment_success')): ?>
      var dialog = new fss.Dialog({title:<?php echo json_encode(__('Confirmation')) ?>, content:$('#payment_success')});
    <?php endif ?>

    <?php if ($sf_request->getParameter('subscription_success')): ?>
      var dialog = new fss.Dialog({title:<?php echo json_encode(__('Confirmation')) ?>, content:$('#subscription_success')});
    <?php endif ?>
<?php endif ?>
});

-->
</script>

<?php if ($current_app !== 'fsmartshop'): ?>
<div id="change_tab_form" style="display : none">
  <p class="first message-yellow"><?php echo __('Change the tab name of your FSmartShop application on your Page') ?></p>
  <form action="" id="tab_name_form">
    <table cellspacing="5" class="editor" align="center">
      <tr>
        <td class="label" width="216">
          <label class="row_description font-size16" for="tab_name">
            <?php echo __('Choose your tab name:') ?>
          </label>
        </td>
        <td>
          <?php echo $app_choice_form['canvas_name']->render(array('class' => 'font-size16', 'style' => 'padding:4px; height:auto')) ?>
        </td>
      </tr>
      <tr>
        <td colspan="2" class="text-center">
          <?php echo __('If you want a different tab name, please %contact% to get a quote.', array('%contact%' => link_to_function(__('contact us directly'), 'contactUs()'))) ?>
        </td>
      </tr>
    </table>
  </form>
</div>


<div id="update_email_tab" style="display:none">
    <p class="first message-yellow"><?php echo __('Critical info about your app, including invoices, will be sent to this address.') ?> </p>
    <p id="error_email" class="message-red mt0" style="display: none"><?php echo __('Your email is not valid') ?></p>
    <div class="vtns_form">
        <div class="vtns_default_form">
            <?php echo fssFormField::fssRender($update_email_form['email'], true); ?>
        </div>
    </div>
</div>


<div id="change_tab_disabled" style="display:none">
    <p class="mt0"><strong><?php echo __('This feature is available only for %paid_plans%.', array('%paid_plans%' => link_to(__('Plus plans or higher'), url_for('@backoffice_subscription')))) ?></strong></p>
</div>

<div id="payment_failed" style="display:none">
  <p class="ma0 message-red"><?php echo __('Your payment has been canceled.') ?></p>
</div>

<div id="subscription_failed" style="display:none">
  <p class="ma0 message-red"><?php echo __('Your subscription has been canceled.') ?></p>
</div>

<div id="payment_success" style="display:none">
  <p class="ma0 message-yellow"><?php echo __('Your payment has been processed successfully. You can create targeted Facebook Ads campaigns.') ?></p>
</div>

<div id="sponsoring_active" style="display:none">
  <p class="ma0 message-yellow"><?php echo __('You gained ads credits by sponsoring one of your friends.') ?></p>
</div>

<div id="job_paused_confirm_message" style="display:none">
  <p class="mt0 message-yellow"><?php echo __('All your job slots are in use, your new job has been paused. You can pause an active job to free a slot or subscribe to a better plan.') ?></p>
</div>
<div id="share_disabled" style="display:none">
    <div><strong><?php echo __('You have to activate the job if you want to share it.') ?></strong></div>
</div>

<?php endif ?>

<? // POST ON THE WALL ?>
<div id="post_wall_success" style="display:none">
    <div class="message-yellow"><?php echo __('The job was posted to your Page\'s wall.') ?></div>
</div>
<div id="post_wall_error" style="display:none">
    <div class="message-red"><?php echo __('There was an error in posting the job to your wall. Please again try later.') ?></div>
</div>

<? // POST ON TWITTER ?>
<div id="twitter_wall_success" style="display:none">
    <div class="message-yellow"><?php echo __('The job was posted on your Twitter account.') ?></div>
</div>
<div id="twitter_wall_error" style="display:none">
    <div class="message-red"><?php echo __('There was an error in posting the job to Twitter. Please again try later.') ?></div>
</div>
